package cn.yh.register.hosp.controller;

import cn.yh.register.common.result.Result;
import cn.yh.register.hosp.service.ScheduleService;
import cn.yh.register.model.hosp.Schedule;
import cn.yh.register.vo.hosp.ScheduleOrderVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

//@CrossOrigin
@Api(tags = "排班管理接口")
@RestController
@RequestMapping("/admin/hosp/schedule")
public class ScheduleController {

    @Autowired
    ScheduleService scheduleService;


    @ApiOperation("获取排班日期分页数据")
    @GetMapping("/getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result<Map<String, Object>> getScheduleRule(@PathVariable Integer page,
                                                       @PathVariable Integer limit,
                                                       @PathVariable String hoscode,
                                                       @PathVariable String depcode) {
        Map<String, Object> map = scheduleService.getRuleSchedule(page, limit, hoscode, depcode);
        return Result.ok(map);
    }

    @ApiOperation("获取某天的排班详情")
    @GetMapping("/getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result<?> getScheduleDetail(@PathVariable String hoscode,
                                       @PathVariable String depcode,
                                       @PathVariable String workDate) {
        List<Schedule> scheduleList = scheduleService.getScheduleList(hoscode, depcode, workDate);
        return Result.ok(scheduleList);
    }




}
